<div class="content-wrapper">

    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>

        <h1 class="pull-right">
            <?php echo $this->HelpUrl('userBalanceLogList'); ?>
        </h1>

    </section>

    <section class="content">
        <?php echo $this->partial('layout/messages'); ?>

        <div class="row">
            <div class="col-xs-12">
                <div class="box shop-box">

                    <div class="box-body table-responsive no-padding">
                        <table class="table shop-table table-hover">
                            <thead>
                            <tr class="shop-bg-thead">
                                <th width="18%"><?php echo $this->translate('客户名称'); ?></th>
                                <th width="10%"><?php echo $this->translate('处理金额'); ?></th>
                                <th width="8%"><?php echo $this->translate('处理类型'); ?></th>
                                <th width="10%"><?php echo $this->translate('账户余额'); ?></th>
                                <th width="12%"><?php echo $this->translate('操作者'); ?></th>
                                <th width="12%"><?php echo $this->translate('操作时间'); ?></th>
                                <th width="22%"><?php echo $this->translate('操作备注'); ?></th>
                                <th width="8%"></th>
                            </tr>
                            <?php
                            $sForm = $this->searchForm;
                            $sForm->prepare();
                            $sForm->get('balance_change_type')->setEmptyOption('选择类型');
                            ?>
                            <?php echo $this->form()->openTag($sForm); ?>
                            <tr>
                                <td>
                                    <?php echo $this->formElement($sForm->get('user_name')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('user_name'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('balance_change_num')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('balance_change_num'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('balance_change_type')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('balance_change_type'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('balance_changed_amount')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('balance_changed_amount'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('search_name')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('search_name'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('start_time')); ?>
                                    </p>
                                    <div>
                                        <?php echo $this->formElement($sForm->get('end_time')); ?>
                                    </div>
                                    <?php echo $this->formElementErrors($sForm->get('start_time'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('end_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('balance_change_info')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('balance_change_info'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-search"></i></button>
                                    <?php
                                    $formData = $sForm->getData();
                                    if(!empty(array_filter($formData))) { ?>
                                        &nbsp;&nbsp;<a href="<?php echo $this->url('user-balance');?>" class="btn btn-default btn-sm"><i class="fa fa-reply"></i></a>
                                    <?php } ?>
                                </td>
                            </tr>
                            <?php echo $this->form()->closeTag(); ?>
                            </thead>
                            <tbody>
                            <?php if($this->balanceLogList->getCurrentItemCount() > 0) foreach ($this->balanceLogList as $log) { ?>
                                <tr>
                                    <td><?php echo $this->escapeHtml($log->getUserName()); ?></td>
                                    <td><?php echo $this->shopCurrencyFormat($log->getBalanceChangeNum()); ?></td>
                                    <td><?php echo $this->userHelper()->userChangeBalanceType($log->getBalanceChangeType()); ?></td>
                                    <td><?php echo $this->shopCurrencyFormat($log->getBalanceChangedAmount()); ?></td>
                                    <td><?php echo $log->getAdminId() > 0 ? $log->getAdminName().'-[<b>'.$this->translate('管理员').'</b>]' : $log->getUserName().'-['.$this->translate('客户').']'; ?></td>
                                    <td><?php echo $this->shopDateFormat()->balanceLogTime($log->getBalanceChangeTime()); ?></td>
                                    <td colspan="2"><?php echo $this->escapeHtml($log->getBalanceChangeInfo()); ?></td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <?php echo $this->paginationControl($this->balanceLogList, 'Sliding', 'layout/page', ['route' => 'user-balance']); ?>
                    </div>
                </div>
            </div>
        </div>

    </section>
</div>
<script type="text/javascript">
    laydate.render({elem: '#start_time'});
    laydate.render({elem: '#end_time'});
</script>